'use strict';

module.exports = app => {
  const { STRING, INTEGER, DATE, TEXT } = app.Sequelize;

  const PdfResume = app.model.define('pdf_resume', {
    id: {
      type: INTEGER,
      primaryKey: true,
      autoIncrement: true
    },
    user_id: {
      type: INTEGER,
      allowNull: false,
      defaultValue: 1,
      comment: '用户ID'
    },
    file_name: {
      type: STRING(255),
      allowNull: false,
      comment: '文件名称（原始名称）'
    },
    file_path: {
      type: STRING(500),
      allowNull: false,
      comment: '文件路径'
    },
    file_size: {
      type: INTEGER,
      allowNull: false,
      comment: '文件大小（字节）'
    },
    file_url: {
      type: STRING(500),
      allowNull: false,
      comment: '访问URL'
    },
    thumbnail_url: {
      type: STRING(500),
      allowNull: true,
      comment: '缩略图URL'
    },
    description: {
      type: TEXT,
      allowNull: true,
      comment: '简历描述'
    },
    status: {
      type: INTEGER,
      defaultValue: 1,
      comment: '状态 1-正常 0-删除'
    },
    created_at: {
      type: DATE,
      allowNull: false,
      defaultValue: app.Sequelize.literal('CURRENT_TIMESTAMP')
    },
    updated_at: {
      type: DATE,
      allowNull: false,
      defaultValue: app.Sequelize.literal('CURRENT_TIMESTAMP')
    }
  }, {
    tableName: 'pdf_resume',
    timestamps: false
  });

  return PdfResume;
};

